package models

import (
	"time"
)

var ReportModels []interface{} = []interface{}{
	&Cpus{}, &Mems{}, &Disks{}, &Process{}, &Service{}, &ServiceData{}, &HisMaxMinAvgVal{}, &NetFlowData{},
}

type BaseModel struct {
	ID          uint `gorm:"primarykey;autoIncrement"`
	CreatedAt   time.Time
	CheckedDate time.Time
}

type Cpus struct {
	BaseModel
	IP         string  `gorm:"" json:"_"`
	SeriesName string  `json:"seriesName"`
	MaxVal     float32 `json:"maxVal"`
	MinVal     float32 `json:"minVal"`
	AvgVal     float32 `json:"avgVal"`
}

type Mems struct {
	BaseModel
	IP              string
	SeriesName      string
	RamSizeWithUnit string
	MaxVal          float32
	MinVal          float32
	AvgVal          float32
}

type Disks struct {
	BaseModel
	IP         string
	SeriesName string
	MaxVal     float32
	MinVal     float32
	AvgVal     float32
	CurVal     float32
	FreeVal    float32
}

type Process struct {
	BaseModel
	IP           string
	SeriesName   string
	StatusText   string
	CpuMaxVal    float32
	CpuMinVal    float32
	CpuAvgVal    float32
	MemMaxVal    float32
	MemMinVal    float32
	MemAvgVal    float32
	AbsMemMaxVal string
	AbsMemMinVal string
	AbsMemAvgVal string
}

type Service struct {
	BaseModel
	IP         string
	SeriesName string
	StatusText string
	MaxVal     float32
	MinVal     float32
	AvgVal     float32
	PortNo     int64
	HisProps   string `gorm:"size:256"`
}

type ServiceData struct {
	BaseModel
	IP          string
	ServiceCode string
	ItemName    string
	RowCount    int64
}

type HisMaxMinAvgVal struct {
	BaseModel
	IP        string
	CpuMaxVal float32
	CpuMinVal float32
	CpuAvgVal float32
	MemMaxVal float32
	MemMinVal float32
	MemAvgVal float32
}

type NetFlowData struct {
	BaseModel
	SysName     string
	App         string
	DstIP       string
	DstPort     string
	SourceIp    string
	SourcePort  string
	Protocol    string
	Traffic     string
	DisplayName string
}

func (c Cpus) TableName() string {
	return "g_cpus"
}

func (d Disks) TableName() string {
	return "g_disks"
}

func (m Mems) TableName() string {
	return "g_mems"
}

func (p Process) TableName() string {
	return "g_process"
}

func (s Service) TableName() string {
	return "g_service"
}

func (s ServiceData) TableName() string {
	return "g_service_data"
}

func (h HisMaxMinAvgVal) TableName() string {
	return "g_history_max_min_avg_value"
}

func (n NetFlowData) TableName() string {
	return "g_net_flow_data"
}
